package org.lex.swing.table;

import java.awt.Component;
import java.text.DateFormat;
import java.util.Date;

import javax.swing.JTable;
import javax.swing.table.DefaultTableCellRenderer;

public class DateRenderer extends DefaultTableCellRenderer {
	private static final DateFormat dateFormat = DateFormat.getDateTimeInstance();
	private Date date = new Date();

	/**
	 * <code>value</code>��һ��Long�ʹ�����ĳ�֤��
	 */
	@Override
	public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
		date.setTime((Long) value);
		this.setText(dateFormat.format(date));
		this.setFont(table.getFont());
		return this;
	}
}
